"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
  data() {
    return {
      userphone: "",
      password: "",
      payment: ""
    };
  },
  methods: {
    register() {
      if (!this.userphone || !this.payment || !this.password) {
        common_vendor.index.showToast({
          title: "所有字段都是必填项",
          icon: "none"
        });
        return;
      }
      common_vendor.index.request({
        url: "http://106.15.182.86:9099/api/register",
        method: "POST",
        data: {
          userphone: this.userphone,
          payment: this.payment,
          password: this.password
        },
        success: (res) => {
          console.log(res.data);
          if (res.data.code === 200) {
            common_vendor.index.showToast({
              title: "注册成功",
              icon: "success",
              duration: 2e3
            });
            common_vendor.index.navigateTo({
              url: "/pages/login/login"
              // 跳转到登录页面
            });
          } else if (res.data.code === 301) {
            common_vendor.index.showToast({
              title: "注册失败，账号已注册",
              icon: "none",
              duration: 2e3
            });
          }
        },
        fail: () => {
          common_vendor.index.showToast({
            title: "网络请求失败，请稍后再试",
            icon: "none"
          });
        }
      });
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return {
    a: $data.userphone,
    b: common_vendor.o(($event) => $data.userphone = $event.detail.value),
    c: $data.password,
    d: common_vendor.o(($event) => $data.password = $event.detail.value),
    e: $data.payment,
    f: common_vendor.o(($event) => $data.payment = $event.detail.value),
    g: common_vendor.o((...args) => $options.register && $options.register(...args))
  };
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e76916ba"]]);
wx.createPage(MiniProgramPage);
